<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 300px;
            height: 300px;
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <div class="box"></div>
    /
    <script>
        const box = document.querySelector('.box')
        function color() {
            return `rgb(${Math.floor(Math.random() * 256)},${Math.floor(Math.random() * 256)},${Math.floor(Math.random() * 256)})`
        }
        box.style.backgroundColor = color()

    </script>
</body>

</html>